package test.构造函数

fun main(args: Array<String>) {
    val person5 = Person5("张三", 20, "13523444554")
}

class Person5(var name: String, var age: Int) {
    init {
        println("执行了初始化")
    }

    constructor(name: String, age: Int, phone: String) : this(name, age) {
        println("执行了次构函数")
    }

    init {
        require(age > 0) { "age must be positive" }
        require(name.isNotBlank()) { "player must have a name" }
    }
}